package ru.jkff.jalgebra.order;

import ru.jkff.jalgebra.monoid.Monoids;
import ru.jkff.jalgebra.monoid.MonoidUtils;
import static ru.jkff.jalgebra.monoid.MonoidUtils.fold;

/**
 * User: jkff
 * Date: Aug 23, 2009
 * Time: 1:15:57 PM
 */
public abstract class LatticeUtils {
    private LatticeUtils() {}

    public static <T> T supremum(BoundedLattice<T> lat, Iterable<T> ts) {
        return fold(Monoids.<T>supInLattice(lat), ts);
    }
    public static <T> T infimum(BoundedLattice<T> lat, Iterable<T> ts) {
        return fold(Monoids.<T>infInLattice(lat), ts);
    }
}
